﻿@using SimplCommerce.Module.Core.Models
@using SimplCommerce.Module.Core.Extensions

@model SimplCommerce.Module.Reviews.Areas.Reviews.ViewModels.ReplyForm

@inject IWorkContext WorkContext
@inject SignInManager<User> SignInManager


@if (SignInManager.IsSignedIn(User))
{
    <form class="form-add-review-reply" asp-area="Reviews" asp-controller="Reply" asp-action="AddReply" method="post" role="form">
        <input asp-for="ReviewId" type="hidden" />
        <div class="form-group">
            <textarea asp-for="Comment" rows="3" placeholder="@Localizer["Your reply"]" maxlength="300" class="form-control"></textarea>
            <span asp-validation-for="Comment" class="text-danger"></span>
        </div>
        <div class="form-group text-right">
             <button class="btn btn-secondary btn-submit-review-reply" type="submit">@Localizer["Submit reply"]</button>
        </div>
    </form>
}
else
{
    var localizedTextParts = Localizer["Please <a>login</a> or <a>register</a> to submit your reply."].GetTextPartsFunction("<a>", "</a>");
    <p>@localizedTextParts(0)<a href="~/login?ReturnUrl=@Context.Request.Path">@localizedTextParts(1)</a>@localizedTextParts(2)<a href="~/register?ReturnUrl=@Context.Request.Path">@localizedTextParts(3)</a>@localizedTextParts(4)</p>
}
